<%@ Control Language="c#" %>
<%@ Register TagPrefix="CS" Namespace="CommunityServer.Controls" Assembly="CommunityServer.Controls" %>
<%@ Register TagPrefix="FileGalleries" Namespace="CommunityServer.Files.Controls" Assembly="CommunityServer.Files" %>
<%@ Import Namespace="CommunityServer.Files.Components" %>
<%@ Import Namespace="CommunityServer.Components" %>

<script runat = "server" language = "C#">

protected string GetClassName(CommunityServer.Components.Group group)
{
	if (CSContext.Current.GroupID == group.GroupID)
	{
		if (CSContext.Current.ApplicationKey == null)
			return "FileMenuGroupItemSelected";
		else
			return "FileMenuGroupItemChildSelected";
	}
	else
		return "FileMenuGroupItem";
}

protected string GetClassName(Folder folder)
{
	if (CSContext.Current.ApplicationKey == folder.ApplicationKey)
	{
		if (CSContext.Current.CategoryID == -1)
			return "FileMenuFolderItemSelected";
		else
			return "FileMenuFolderItemChildSelected";
	}
	else
		return "FileMenuFolderItem";
}

protected string GetClassName(PostCategory category)
{
	if (CSContext.Current.CategoryID == category.CategoryID)
		return "FileMenuCategoryItemSelected";
	else
		return "FileMenuCategoryItem";
}

</script>

<div class="FileMenuArea">
	<div class="FileMenuContent">
		<asp:Repeater Runat="server" ID="FolderGroups">
			<HeaderTemplate>
				<ul class="FileMenuGroupList">
			</HeaderTemplate>
			<ItemTemplate>
					<li><div class="<%# GetClassName((CommunityServer.Components.Group) Container.DataItem) %>"><asp:HyperLink ID="GroupName" Runat="server" /></div>
					<asp:Repeater runat="server" id="Folders">
						<HeaderTemplate>
							<ul class="FileMenuFolderList">
						</HeaderTemplate>
						<ItemTemplate>
							<li><div class="<%# GetClassName((Folder) Container.DataItem) %>"><asp:HyperLink ID="Name" Runat="server" /> (<asp:Label ID="Files" Runat="server" />)</div>
							<asp:Repeater runat="server" id="Categories">
								<HeaderTemplate>
									<ul class="FileMenuCategoryList">
								</HeaderTemplate>
								<ItemTemplate>
									<li><div class="<%# GetClassName((PostCategory) Container.DataItem) %>"><asp:HyperLink ID="Name" Runat="server" /> (<asp:Label ID="Files" Runat="server" />)</div></li>
								</ItemTemplate>
								<FooterTemplate>
									</ul>
								</FooterTemplate>
							</asp:Repeater>
							</li>
						</ItemTemplate>
						<FooterTemplate>
							</ul>
						</FooterTemplate>
					</asp:Repeater>
					</li>
			</ItemTemplate>
			<FooterTemplate>
				</ul>
			</FooterTemplate>
		</asp:Repeater>
	</div>
</div>
